package com.example.baseui2.recycleVIew

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.baseui2.R
import com.example.baseui2.bean.RecycleViewBean
import kotlinx.android.synthetic.main.activity_recycle_view.*

class RecycleViewActivity : AppCompatActivity() {

    private val mAdapter:RecycleViewAdapter by lazy {
        RecycleViewAdapter()
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_recycle_view)
        recycleView.adapter=mAdapter
        recycleView.layoutManager=LinearLayoutManager(this)

        var data: MutableList<RecycleViewBean> = mutableListOf()
        for (index in 0..100){
            data.add(RecycleViewBean(R.drawable.ic_launcher_background,"test"+index))
        }
        mAdapter.addData(data)
    }
}